﻿@{
    ViewBag.Title = "订单信息管理";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="~/Content/js/common.js"></script>
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script>
    $(function () {
        gridList();
    })

    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Order/GetGridJson",
            height: $(window).height() - 128,
            colModel: [
                { label: '主键', name: 'ID', hidden: true },
                { label: '订单编号', name: 'ID', width: 100, align: 'left' },
                { label: '用户手机号', name: 'UserTel', width: 100, align: 'left' },
                {
                    label: '服务类型', name: 'ServiceType', width: 60, align: 'center',
                    formatter: function (cellvalue, options, rowObject) {
                        if (cellvalue == 1) {
                            return '剪发';
                        } else if (cellvalue == 0) {
                            return '烫染';
                        }
                    }
                },
                { label: '金额', name: 'Fee', width: 100, align: 'left' },
                 { label: '下单时间', name: 'OrderCreateTime', width: 100, align: 'left' },
                { label: '店面', name: 'ShopName', width: 150, align: 'left' },
                { label: '发型师', name: 'StyleName', width: 150, align: 'left' },
                { label: '发型师手机号', name: 'StyleTel', width: 150, align: 'left' },
                {
                    label: '订单状态', name: 'Status', width: 60, align: 'center',
                    formatter: function (cellvalue, options, rowObject) {
                        if (cellvalue == 1) {
                            return '已支付';
                        } else if (cellvalue == 0) {
                            return '未支付';
                        } else if (cellvalue == 2) {
                            return '已取消';
                        }
                    }
                },
                {
                    label: '支付时间', name: 'CommentDate', width: 66, align: 'left',
                    formatter: function (cellvalue, options, rowObject) {
                        return (new Date(rowObject.CommentDate).format("yyyy-MM-dd"));
                    }
                }
                //{ label: '备注', name: 'Remark', width: 150, align: 'left' }
            ],
            pager: "#gridPager",
            sortname: 'ID asc,UpdateTime desc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: {
                    seOrderStatus: $("#orderStatus").val() == "选择订单状态" ? "" : $("#orderStatus").val(),
                    OrderID: $("#txt_OrderID").val() ,
                    ShopName: $.trim($("#txt_Shop").val()),
                    StyleTel: $.trim($("#txt_Style").val()),
                    UserTel: $.trim($("#txt_Tel").val()),
                    StartTime: $.trim($("#StartTime").val()),
                    EndTime: $.trim($("#EndTime").val())
                },
            }).trigger('reloadGrid');
        });
    }
    function btn_delete() {
        $.deleteForm({
            url: "/Comment/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().ID },
            prompt: "注：您确定要删除该项数据吗？",
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_Agree() {
        $.deleteForm({
            url: "/Comment/Agree",
            param: { keyValue: $("#gridList").jqGridRowValue().ID },
            prompt: "注：您确定要审核通过吗？",
            loading: "正在执行操作...",
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_Refuse() {
        $.deleteForm({
            url: "/Comment/Refuse",
            param: { keyValue: $("#gridList").jqGridRowValue().ID },
            prompt: "注：您确定要审核不通过吗？",
            loading: "正在执行操作...",
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().ID;
        $.modalOpen({
            id: "Details",
            title: "查看评论",
            url: "/Comment/Details?keyValue=" + keyValue,
            width: "700px",
            height: "550px",
            btn: null,
        });
    }
</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新增店面</a>
        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                @*<li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改评论</a></li>
                    <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除店面</a></li>*@
                <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看</a></li>
                <li class="split"></li>
                <li><a id="NF-disabled" authorize="yes" onclick="btn_Open()"><i class="fa fa-stop-circle"></i>设置已支付</a></li>
                <li><a id="NF-enabled" authorize="yes" onclick="btn_Close()"><i class="fa fa-play-circle"></i>设置未支付</a></li>
                <li><a id="NF-enabled" authorize="yes" onclick="btn_Close()"><i class="fa fa-play-circle"></i>设置已取消</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <select id="orderStatus" name="orderStatus" class="form-control" style="width: 120px;  margin-left: 10px;">
                            <option>选择订单状态</option>
                            <option value="0">未支付</option>
                            <option value="1">已支付</option>
                            <option value="2">已取消</option>
                        </select>
                        <input id="txt_OrderID" type="text" class="form-control" placeholder="订单编号" style="width: 120px;margin-left: 10px;" maxlength="25">
                        <input id="txt_Shop" type="text" class="form-control" placeholder="店面名称" style="width: 120px;margin-left: 10px;" maxlength="25">
                        <input id="txt_Style" type="text" class="form-control" placeholder="发型师手机号" style="width: 120px;margin-left: 10px;" maxlength="25">
                        <input id="txt_Tel" type="text" class="form-control" placeholder="用户手机号" style="width: 120px;margin-left: 10px;" maxlength="25">
                        <input id="StartTime" name="SetUpTime" type="text" class="input-wdatepicker" style="width: 120px;margin-left: 10px;height:31px;" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="下单开始时间">
                        <input id="EndTime" name="SetUpTime" type="text" class="input-wdatepicker" style="width: 120px;margin-left: 10px;height:31px;" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="下单结束时间">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
